package com.ocom.xfrecode.controller;


import com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator;
import com.ocom.xfrecode.entity.MjRecord;
import com.ocom.xfrecode.service.MjRecodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
public class MjLogController {

	@Autowired
	private MjRecodeService mjRecodeService;

	@Autowired
	private IdGenerator idGenerator;

	@GetMapping("/test1")
	public Integer saveAccessRecord( ){
		MjRecord mjRecord =new MjRecord();
		mjRecord.setId(idGenerator.generateId().intValue());
		Random random=new Random();
		int rand=random.nextInt(9);
		rand++;
		mjRecord.setComId(rand);
		mjRecord.setMonthValue("202201");
		mjRecodeService.add(mjRecord);
		return 123;
	}

}
